<?php

namespace App\VO\UserAddresses;

use App\Entity\UserAddressEntity;
use App\Models\UserAddress as UserAddressModel;
use App\VO\Interfaces\IVOListItem;

class VOListItem implements IVOListItem
{
    public $id;
    public $contact_name;
    public $contact_phone;
    public $full_address;
    public $isdefault;
    public $enable = false;

    public function __construct(UserAddressModel $userAddressModel)
    {
        $userAddressEntity = new UserAddressEntity($userAddressModel);
        $this->id = $userAddressEntity->getId();
        $this->contact_name = $userAddressEntity->getContactName();
        $this->contact_phone = $userAddressEntity->getContactPhone();
        $this->full_address = $userAddressEntity->getFullAddress();
        $this->isdefault = $userAddressEntity->getIsdefault();
        if ($userAddressModel->enable !== null) {
            $this->enable = $userAddressModel->enable;
        }
    }
}
